import { RDAction, RDStore } from '@/redux';
import { useDispatch, useSelector } from 'react-redux';
import { Space, Button } from 'antd';
import { RDMemberActions } from '@/redux/memberReducer';
import { Dispatch } from 'redux';

export default function IndexPage() {
  const count = useSelector((state: RDStore) => state.memberReducer.count);
  const dispatch = useDispatch<Dispatch<RDAction>>();
  return (
    <div style={{ padding: 50 }} >
      <div>
        {count}
      </div>
      <Space>
        <Button onClick={() => dispatch({ type: RDMemberActions.add, data: count + 1 })} >新增</Button>
        <Button onClick={() => dispatch({ type: RDMemberActions.add, data: count - 1 })} >减少</Button>
      </Space>
    </div>
  );
}
